Hook for fetching native token balances across multiple chains
UseQueryResult<TokenBalance[]>
UseQueryResult
with token balance data. Here’s the detailed structure:
TokenBalance[] | undefined
Array of token balance objects containing:
chainId
: The chain ID where the balance was fetched fromaccountAddress
: The address whose balance was queriedcontractAddress
: The address of the native token (typically zero address)balance
: The balance amount in the token’s base unitscontractType
: The type of contract (e.g., ERC20, ERC721, ERC1155)contractInfo
: Additional contract informationtokenMetadata
: Metadata about the tokenblockHash
: The hash of the block in which the balance was recordedblockNumber
: The number of the block in which the balance was recordeduniqueCollectibles
: The number of unique collectiblesisSummary
: Whether the balance is a summarytokenID
: The ID of the token (for ERC721 and ERC1155 tokens)boolean
Loading state for the data fetch.
boolean
Error state indicating if the query failed.
Error | null
Any error that occurred during data fetching.
GetNativeTokenBalanceArgs
Parameter | Type | Description |
---|---|---|
accountAddress | string | The address to fetch balances for |
chainIds | number[] | Array of chain IDs to fetch balances from |
networks | string[] | Array of network names to fetch balances from |
HooksOptions
Parameter | Type | Description |
---|---|---|
disabled | boolean | (Optional) Disable the query from automatically running |
retry | boolean | (Optional) Whether to retry failed queries |